<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppCurrent)-browser</TargetFrameworks>
    <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
    <UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
  </PropertyGroup>

  <!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
  <PropertyGroup>
    <TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>
    <FeatureWasmManagedThreads Condition="'$(TargetPlatformIdentifier)' == 'browser' and '$(WasmEnableThreads)' == 'true'">true</FeatureWasmManagedThreads>
    <DefineConstants Condition="'$(TargetPlatformIdentifier)' == 'browser'">$(DefineConstants);TARGET_BROWSER</DefineConstants>
    <DefineConstants Condition="'$(FeatureWasmManagedThreads)' == 'true'" >$(DefineConstants);FEATURE_WASM_MANAGED_THREADS</DefineConstants>
    <EmitCompilerGeneratedFiles Condition="'$(Configuration)' == 'Debug' and '$(TargetPlatformIdentifier)' == 'browser'">true</EmitCompilerGeneratedFiles>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="System\Net\WebSockets\ClientWebSocket.cs" />
    <Compile Include="System\Net\WebSockets\ClientWebSocketDeflateConstants.cs" />
    <Compile Include="$(CommonPath)System\Net\UriScheme.cs" Link="Common\System\Net\UriScheme.cs" />
    <Compile Include="$(CommonPath)System\Net\WebSockets\WebSocketValidate.cs" Link="Common\System\Net\WebSockets\WebSocketValidate.cs" />
    <Compile Include="System\Net\WebSockets\HttpResponseHeadersReadOnlyCollection.cs" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetPlatformIdentifier)' != 'browser'">
    <Compile Include="System\Net\WebSockets\ClientWebSocketOptions.cs" />
    <Compile Include="System\Net\WebSockets\WebSocketHandle.Managed.cs" />
    <Compile Include="$(CommonPath)System\Net\HttpKnownHeaderNames.cs" Link="Common\System\Net\HttpKnownHeaderNames.cs" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'browser'">
    <Compile Include="System\Net\WebSockets\WebSocketHandle.Browser.cs" />
    <Compile Include="System\Net\WebSockets\BrowserWebSockets\BrowserInterop.cs" />
    <Compile Include="System\Net\WebSockets\BrowserWebSockets\BrowserWebSocket.cs" />
    <Compile Include="System\Net\WebSockets\BrowserWebSockets\ClientWebSocketOptions.cs" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="Microsoft.Win32.Primitives" />
    <Reference Include="System.Collections.NonGeneric" />
    <Reference Include="System.Collections.Specialized" />
    <Reference Include="System.Diagnostics.Tracing" />
    <Reference Include="System.Net.Primitives" />
    <Reference Include="System.Net.Security" />
    <Reference Include="System.Net.WebHeaderCollection" />
    <Reference Include="System.Net.WebSockets" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Security.Cryptography" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetPlatformIdentifier)' != 'browser'">
    <Reference Include="System.Collections" />
    <Reference Include="System.Runtime" />
    <Reference Include="System.Threading" />
    <Reference Include="System.Memory" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'browser'">
    <Reference Include="System.Threading.Channels" />
    <ProjectReference Include="$(CoreLibProject)" />
    <ProjectReference Include="$(LibrariesProjectRoot)System.Private.Uri\src\System.Private.Uri.csproj" PrivateAssets="all" />
    <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\src\System.Runtime.csproj" />
    <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\gen\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
    <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices.JavaScript\gen\JSImportGenerator\JSImportGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
    <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices.JavaScript\src\System.Runtime.InteropServices.JavaScript.csproj" SkipUseReferenceAssembly="true" />
  </ItemGroup>

</Project>
